package com.inifitness.tenant.core.system.converter;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inifitness.tenant.core.system.model.bo.BizUserAcctBO;
import com.inifitness.tenant.core.system.model.entity.BizUserAcct;
import com.inifitness.tenant.core.system.model.form.BizUserForm;
import com.inifitness.tenant.core.system.model.vo.BizUserAcctImportVO;
import com.inifitness.tenant.core.system.model.vo.BizUserInfoVO;
import com.inifitness.tenant.core.system.model.vo.BizUserPageVO;

import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 用户对象转换器
 *
 * @author sunjinfeng
 * @since 2024/04/18 11:00:00
 */
@Mapper(componentModel = "spring")
public interface BizUserAcctConverter {

  @Mapping(target = "genderLabel", expression = "java(com.inifitness.common.basic.BaseEnum.getLabelByValue(com.inifitness.common.enums.GenderEnum.class,bo.getGender()))")
  BizUserPageVO bo2PageVo(BizUserAcctBO bo);

  Page<BizUserPageVO> bo2PageVo(Page<BizUserAcctBO> bo);

  BizUserForm entity2Form(BizUserAcct entity);

  @InheritInverseConfiguration(name = "entity2Form")
  BizUserAcct form2Entity(BizUserForm entity);

  @Mapping(target = "userId", source = "id")
  BizUserInfoVO toUserInfoVo(BizUserAcct entity);

  BizUserAcct importVo2Entity(BizUserAcctImportVO vo);

}
